function BaseReport() {
    return {
        /**
         * 初始化（启动 表）
         * @param ds
         */
        init: function (ds) {
            $(document).ready(function () {
                this._onInit(ds);
            }.bind(this));
        },

        /**
         * 返回数 源
         * @returns {*}
         */
        getDataSource: function () {
            return this.dataSource;
        },

        /**
         * 页面加载完 时的，进行真正的初始化
         * @param ds
         */
        _onInit: function (ds) {
            if (!ds) {
                return;
            }

            this.dataSource = ds;

            this._initUI();

            if (this.dataSource.chart) {
                this._initChart();
            }

            this.onInit();
        },

        /**
         * 初始化UI
         * @private
         */
        _initUI: function () {
            var scope = $("body").scope();
            if (this.dataSource.searchBar) {
                this.searchBar = this.initSearchBar();
            }
            this._initTimeFilter();

            this.tableBar = TableBar(this._tableBarHandler.bind(this));
        },

        initSearchBar: function () {
            return SearchBar($.extend({},
                this.dataSource.searchBar, {
                    searchHandler: this._searchHandler.bind(this)
                }));
        },

        _initTimeFilter: function () {
            if (!this.dataSource.timeFilter) {
                $("#div_time_filter").parents(".row-fluid").hide();
                return;
            }
            var options = $.extend({},
                this.dataSource.timeFilter,
                {
                    handler: this._filterHandler.bind(this)
                });

            this.timeFilter = TimeFilter(options);
        },

        /**
         * 搜索触发Handler
         * @param param
         * @private
         */
        _searchHandler: function (param) {
            if (!this.dataSource.list) {
                return;
            }

            param = $.extend({}, param,  this.timeFilter? this.timeFilter.getParameter():{});

            var pDatas = this.searchBar.getSearchValues();
            if (!this._invalidParam(pDatas)) {
                return;
            }

            if (this.dataSource.chart) {
                $(this.chart.series).each(function (k, v) {
                    v.remove(false);
                });
            }

            var tabDatas = this.createTabs(pDatas, $.extend({}, param));

            this._createTabs(tabDatas);
            this._createTables(tabDatas);
        },

        _invalidParam: function (p) {
            var multiple = 0, single = 0, empty = 0;
            for (var k in p) {
                var v = p[k];
                if ($.isArray(v)) {
                    if (v.length > 1) {
                        multiple++;
                    } else if (v.length == 1) {
                        single++;
                    } else {
                        empty++;
                    }
                }
            }
            ;
            if (empty > 0 && this.dataSource.enableSearchBarEmptySelect!==true) {
                alert("条件不能为空！");
                return false;
            }
            if (multiple > 1 && this.dataSource.enableSearchBarMultiMultiSelect!==true) {
                alert("不支持多个多选条件！");
                return false;
            }
            return true;
        },

        _createTabs: function (tabDatas) {
            if (tabDatas.length > 0) {
                var tabs = [];
                $(tabDatas).each(function (i, v) {
                    tabs.push({
                        key: v.key,
                        title: v.title,
                        value: v.value
                    });
                });
                this.tableBar.addTabs(tabs);
            }
        },

        _createTables: function (tabDatas) {
            var key,value;
            $(tabDatas).each(function (i, v) {
                var tmp = {
                    firstShow: i == 0,
                    key: v.key,
                    value: v.value,
                    templete: this.getTableTemplete(),
                    params: v.param,
                    callback: function (data) {
                        if (this.dataSource.chart) {
                            this._loadChartData(data, v.key, v.value);
                        }
                        if (this.dataSource.list.SuccessCallback) {
                            this._succeedCallBack(data, v.key, v.value);
                        }
                    }.bind(this)
                };
                if(i==0) {
                    key = v.key;
                    value = v.value;
                }
                op = $.extend({}, this.dataSource.list, tmp);
                tableMgr.create(op);
            }.bind(this));
            if(key&&value) {
                tableMgr.show(key, value);
            }
        },

        /**
         * 时间段选 触发Handler
         * @param param
         * @private
         */
        _filterHandler: function (param) {
            if (this.dataSource.chart) {
                $(this.chart.series).each(function (k, v) {
                    v.remove(false);
                });
            }

            tableMgr.refresh(param);
        },

        _tableBarHandler: function (key, value) {
            tableMgr.show(key, value);
        },

        /**
         * 初始化图表
         */
        _initChart: function () {
            var chartOptions = this.getChartOptions();

            Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, function (color) {
                return {
                    radialGradient: {
                        cx: 0.5,
                        cy: 0.3,
                        r: 0.7
                    },
                    stops: [
                        [0, color],
                        [1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
                    ]
                };
            });

            this.chart = Highcharts.chart(this.dataSource.chart.container, chartOptions);
        },

        /**
         * 加载图表数
         */
        _loadChartData: function (data, key, value) {
            if (!this.dataSource.chart) {
                return;
            }

            this.chart.showLoading();

            if (data.total <= 0) {
                this.chart.hideLoading();
                return;
            }
            var options = this.onParseChartOptions(data.rows, this.searchBar.getSearchValues(), key, value);

            if (options) {
                var series = options.series;
                options.series = [];
                for (var i = 0; i < series.length; i++) {
                    this.chart.addSeries(series[i]);
                }
                this.chart.update(options);

                this.chart.redraw();
            }

            this.chart.hideLoading();
        },

        _succeedCallBack : function (data, key, value) {
            this.onTableCallback(data);
        },

        /**
         *
         * @param ext
         * @returns {{}}
         */
        extend: function (ext) {
            var obj = {};
            $.extend(obj, this, ext);
            return obj;
        },

        updateRow: function (key, value, index, data) {
            tableMgr.updateRow(key, value, index, data);
        },

        updateCell: function (key, value, index, field, fieldValue) {
            tableMgr.updateCell(key, value, index, field, fieldValue);
        },

        //**********************************一下是子报表需实现接口**********************************

        onInit: function () {

        },

        /**
         * 返回图表设置项
         */
        getChartOptions: function () {

        },

        getTableTemplete: function () {

        }
    };
};